<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>H+ 后台主题UI框架 - 空白页</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="__STATIC__/layout/favicon.ico">
    <link href="__STATIC__/layout/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__STATIC__/layout/css/font-awesome.css?v=4.4.0" rel="stylesheet">
     <!-- jqgrid-->
    <link href="__STATIC__/layout/css/animate.css" rel="stylesheet">
    <link href="__STATIC__/layout/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="__STATIC__/layout/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="__STATIC__/layout/css/gyq.css" rel="stylesheet">
    <link rel="stylesheet" href="__STATIC__/layout/css/demo.css" type="text/css">

     <link rel="stylesheet" href="__STATIC__/layout/css/channel.css" type="text/css">
</head>

<body style="color:#333;padding:3px;">
   <!-- 标题 -->
    <div class="page-heade">
      <h2 class="title_color text-center">财年({$year})科目日常费用报销汇总</h2>
    </div>
    <!-- 标题 -->
    <div>
    <form method="post" id="f1"  class="form-inline">
      <table class="row-margin-top tab-content table-bordered table " border="1">
          <tr>
            <td style="min-width: 180px;width: 180px" class="text-right">财年：</td>
            <td>
              <select name="year" id="year" class="form-control">
                  {volist name="cainian" id="c"}
                    {if $c.id==$data.year}
                      <option value="{$c.id}" selected>{$c.title}</option>
                    {else/}
                      <option value="{$c.id}">{$c.title}</option>
                    {/if}
                  {/volist}
              </select>
            </td>
             <td style="min-width: 180px;width: 180px" class="text-right">二级费用科目名称：</td>
            <td>
              <div class="container-fluid">
                            <div class="row">
                                <div class="col-xs-11">
                                    <div class="input-group"  {if $data.kemu2} style="display:none;"{/if} >
                                        <input type="text" placeholder="请输入关键字或空格查询" class="kemu2 form-control"  name="kemu2" value="{$data.kemu2}">
                                        <div class="input-group-btn">
                                            <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                                                <span class="caret"></span>
                                            </button>
                                            <ul class="dropdown-menu dropdown-menu-right" role="menu">
                                            </ul>
                                        </div>
                                    </div>
                                    <div class="selectedOnlyOne " {if $data.kemu2} {else/} style="display:none;"{/if}  >
                                      
                                        <span class="inin">{$kemu2}</span>
                                        <span class="close">×</span>
                                    </div>
                                </div>
                              
                           </div>
                        </div>
            </td>
              <td style="min-width: 180px;width: 180px" class="text-right">三级费用科目名称：</td>
            <td>
              <div class="container-fluid">
                            <div class="row">
                                <div class="col-xs-11">
                                    <div class="input-group"   {if $data.kemu3} style="display:none;"{/if}>
                                        <input type="text" placeholder="请输入关键字或空格查询" class="kemu3 form-control"  name="kemu3" value="{$data.kemu3}">
                                        <div class="input-group-btn">
                                            <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                                                <span class="caret"></span>
                                            </button>
                                            <ul class="dropdown-menu dropdown-menu-right" role="menu">
                                            </ul>
                                        </div>
                                    </div>
                                    <div class="selectedOnlyOne "  {if $data.kemu3} {else/} style="display:none;"{/if}  >
                                      
                                        <span class="inin">{$kemu3}</span>
                                        <span class="close">×</span>
                                    </div>
                                </div>
                              
                           </div>
                        </div>
            </td>
         </tr>
         <tr>
            <td colspan="6" class="text-center">
            <button class="btn btn-info query" type="button" id="check">查询</button>
            <button class="btn btn-info emptyIf" type="button" id="clearcheck">清空查询条件</button>
            <button class="btn btn-info LendExcel" type="button" onclick="daochu()">导出Excel</button>
            </td>
         </tr>
         <tr>
            <td class="text-right" colspan="6">  <span class="font-bold"> 金额单元：元</span></td>
         </tr>
      </table>
      <table class="table row-margin-top table-bordered table-hover text-center bud_hei">
          <tr class="info">
            <th class="text-center">序号</th>
            <th class="text-center">二级科目</th>
            <th class="text-center">三级科目</th>
             {volist name="kaohe" id="k2"}
            <th class="text-center">{$k2.title}</th>
            {/volist}
            <th class="text-center">小计</th>
          </tr>
         {volist name="zong" id="vo" key="k"}
       <tr>
        <td class="text-center">{$k}</td>
        <td class="text-left">{$vo.kemu2}</td>
        <td class="text-left">{$vo.kemu3}</td>
        {volist name="kaohe" id="k2" key="g"}
        <td class="ObjectNum num ji{$g}">
          {volist name="$vo.detail" id="d"}
            {if $d.kaohe==$k2.id}
              {$d.jine}
            {/if}
          {/volist}
        </td>
        {/volist}
        <td class="ObjectNum warning">{$vo.jine}</td>
      </tr> 
      {/volist}
          <tfoot>
              <tr class="trTotal font-bold text-right">
                <td colspan="3">总计：</td>
                 {volist name="kaohe" id="k2" key="g"}
                  <td class="ObjectNum he{$g}">-</td>
                  {/volist}
                    <td class="ObjectNum zonghe">0</td>
                </tr>
          </tfoot>
      </table>
</form>
    </div>

    </div>
    <!-- 全局js -->
    <script src="__STATIC__/layout/js/jquery.min.js?v=2.1.4"></script>
    <script src="__STATIC__/layout/js/bootstrap.min.js?v=3.3.6"></script>
    <!-- <script src="js/plugins/metisMenu/jquery.metisMenu.js"></script> -->
    <script src="__STATIC__/layout/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
     <script src="__STATIC__/layout/js/common.js"></script>

<script src="__STATIC__/layout/js/plugins/suggest/bootstrap-suggest.min.js"></script>
    <script>
    function daochu(){
      window.open("{:url('Rcexecel/kemu')}?cn="+$("#year").val())
    }
    $("#check").click(function(){
      document.getElementById("f1").submit();
    })
    $("#clearcheck").click(function(){
      $("input").val("")
      $("select").val(0)
      document.getElementById("f1").submit();
    })
     //科目2搜索自动补全
    $(".kemu2").bsSuggest({
        url: "{:url('kemu2json')}",
        /*effectiveFields: ["userName", "shortAccount"],
         searchFields: [ "shortAccount"],*/
        effectiveFieldsAlias:{title: "名称"},
        ignorecase: true,
        showHeader: true,
        showBtn: false,     //不显示下拉按钮
        delayUntilKeyup: true, //获取数据的方式为 firstByUrl 时，延迟到有输入/获取到焦点时才请求数据
        idField: "id",
        keyField: "title",
        clearable: true
    }).on('onSetSelectValue', function (e, keyword, data) {
        $(this).closest('.input-group').hide().next('.selectedOnlyOne').show().find('.inin').html(keyword.key)
        $(this).val(keyword.id)

    });
      //科目3搜索自动补全
    $(".kemu3").bsSuggest({
        url: "{:url('kemu3json')}",
        /*effectiveFields: ["userName", "shortAccount"],
         searchFields: [ "shortAccount"],*/
        effectiveFieldsAlias:{title: "名称"},
        ignorecase: true,
        showHeader: true,
        showBtn: false,     //不显示下拉按钮
        delayUntilKeyup: true, //获取数据的方式为 firstByUrl 时，延迟到有输入/获取到焦点时才请求数据
        idField: "id",
        keyField: "title",
        clearable: true
    }).on('onSetSelectValue', function (e, keyword, data) {
        $(this).closest('.input-group').hide().next('.selectedOnlyOne').show().find('.inin').html(keyword.key)
        $(this).val(keyword.id)

    });
       //取消单选
    $('body').on('click','.selectedOnlyOne .close',function () {
        $(this).closest('.selectedOnlyOne').hide().find('.inin').html('')
        $(this).closest('.selectedOnlyOne').prev('.input-group').show().find('input').val('')
    })
        $(document).ready(function(){
               $(".num").each(function(){
                if(isNaN(parseFloat($(this).html())))
                    $(this).html("-")
              })
                var num={$kaoc};
          var zonghe=0;
          for(var i=1;i<=num;i++){
            var he=0;
            $(".ji"+i).each(function(){
              if(!isNaN(parseFloat($(this).html())))
                he+=parseFloat($(this).html());
            })
            if(he==0){
              $(".he"+i).html("-")
            }else{
              $(".he"+i).html(he.toFixed(2))
            }
            zonghe+=he;
          }
          if(zonghe==0)
            $(".zonghe").html("-")
          else
            $(".zonghe").html(zonghe.toFixed(2))
               var $ObjectNum =$(".ObjectNum");
             toNum($ObjectNum);
        })
    </script>
</body>

</html>
